<template>
  <div class="content">
    <div class="img_div">
      <el-image class="el_image_class" fit="cover" :src="util_images_url(data.img)"></el-image>
    </div>
    <div class="title">{{ data.title }}</div>
  </div>
</template>

<script>

export default {
  props: ["data"],
  setup() {

    const util_images_url = (name) => {
      return new URL(`../../../assets/images/${name}`, import.meta.url).href;
    };

    return {
      util_images_url,
    };
  },
};
</script>

<style lang="less" scoped>
.content {
  width: 10rem;
  height: 10rem;
  margin: 10px;

  .img_div {
    border: 2px solid orange;
    width: 100%;
    height: 8rem;
    overflow: hidden;

    .el_image_class {
      height: 8rem;
      transition: all 500ms linear;
      transform-origin: 0 0;
    }
    .el_image_class:hover {
      height: 9rem;
    }
  }

  .img_div:hover + .title {
    color: gold;
  }



  .title {
    width: 100%;
    overflow: hidden;
    text-align: center;
    font-size: 1rem;
    line-height: 30px;
    color: #333;
  }
}
</style>
